<script>
  let flag = true;
  const handleToggle = () => {
    flag = !flag;
  };
</script>

<main>
  {#if flag}
    <div>true</div>
  {:else}
    <div>false</div>
  {/if}
  <button on:click={handleToggle}>toggle</button>
</main>
